Power management with dynamic frequency adjustments

ABSTRACT

A central processing unit (CPU) can specify an initial (e.g., baseline) frequency for a clock signal used by a device to perform a task. The CPU is then placed in a reduced power mode. The device performs the task after the CPU is placed in the reduced power mode until a triggering event causes the device to send an interrupt to the CPU. In response to the interrupt, the CPU awakens to dynamically adjust the clock frequency. If the clock frequency is reset to the baseline value, then the CPU is again placed in the reduced power mode.

FIELD

Embodiments according to the present invention generally relate to power management in limited-powered devices.

BACKGROUND

Power consumption is of particular concern to limited-power devices (e.g., battery-powered devices) such as laptop and notebook computer systems, cell phones, personal digital assistants (PDAs), portable media players, remote control units, hand-held devices including video game players, and the like. These devices are limited in size and weight and generally portable, and therefore they typically use smaller and lighter batteries of limited capacity. However, these types of devices may be used for a variety of computationally intensive and therefore power-hungry applications such as three-dimensional (3D) rendering and video encoding and decoding. As a result, such devices can usually be used only for relatively short periods of time before their batteries need to be recharged.

SUMMARY

Embodiments according to the present invention provide methods and systems for conserving power in limited-powered devices. In one embodiment, a central processing unit (CPU, e.g., a microprocessor) identifies a type of task to be performed and a device to perform that task. Based on the type of task and also on the device identified, the CPU selects an initial (or baseline) frequency for a clock signal to be used by the device(s) to perform the task. A baseline frequency can be predefined for each type of task, based on the known workload associated with each type of task. As such, the baseline frequency can be looked up by the CPU knowing the task to be performed.

The baseline frequency is a function of task and which device is used for the task. For example, a single task may be executed by two different devices. A different baseline frequency may be specified for each device. The discussion below describes the singular case but can be readily extended to cases involving multiple devices.

After selecting a device and setting the initial clock frequency, the CPU can enter a “reduced power mode.” In general, the CPU's power is reduced to less than its normal power level. More specifically, the CPU may be “power gated” (e.g., turned off until it is needed). The selected device continues to execute the task using the baseline frequency after the CPU enters the reduced power mode.

If the clock frequency needs to be increased from the baseline frequency because the device is experiencing an increase in workload, the CPU can be awakened using an interrupt or the like. Once awakened, the CPU can dynamically adjust the frequency of the clock signal to track the actual workload of the device.

Before the CPU is awakened, the device can monitor its workload by monitoring relevant indicators. For example, buffer capacity can be monitored and the CPU awakened if remaining capacity falls below a predefined threshold. Once awakened, the CPU can measure, for example, the amount of time that the device is idle by counting the number of idle clock cycles. If the device's “idle time” decreases below a certain threshold, then the frequency of the clock signal can be increased adaptively; and if the idle time increases above that threshold (or a different threshold), then the frequency of the clock signal can be decreased adaptively. The clock frequency can be dynamically adjusted in this manner until it returns to the baseline frequency. Once the clock frequency is reduced back to its baseline frequency, the CPU can be returned to the reduced power mode.

In summary, once the baseline frequency is initially set by the CPU, the CPU can be powered down or turned off to save power. With the CPU in the reduced power mode, idle time is not monitored and clock frequency is not adjusted by the CPU. The CPU can be subsequently awakened in response to a triggering event that indicates that the frequency of the clock signal needs to be increased above the baseline. The CPU remains awake while the clock frequency is above the baseline, and idle time is monitored so that further adjustments to the clock frequency can be made if necessary. Once the workload decreases to a point where the clock frequency can be reset to the baseline frequency, the CPU can again be powered down or turned off and perhaps subsequently reawakened to repeat the process just described.

Thus, power is conserved on at least two fronts. First, power consumption is reduced because the CPU is not running continuously at full power—once the CPU selects a device and a baseline frequency, it can be powered down or turned off until it is needed. Second, the frequency of the clock signal used by the device is adjusted up and down depending on workload—because power usage is a function of clock frequency, the capability to scale frequency to workload means that power is used more efficiently. By intelligently selecting an appropriate baseline frequency and then adjusting it as needed, and by selectively running the CPU in the manner just described, a net savings in power is realized.

These and other objects and advantages of the various embodiments of the present invention will be recognized by those of ordinary skill in the art after reading the following detailed description of the embodiments that are illustrated in the various drawing figures.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements.

FIG. 1 is a block diagram showing an example of a computing system platform upon which embodiments according to the present invention may be implemented.

FIGS. 2A and 2B are a block diagrams showing embodiments of power management systems in accordance with the present invention.

FIG. 3 is a block diagram representing a clock signal frequency adjustment loop in one embodiment in accordance with the present invention.

FIG. 4 is a diagram showing clock signal frequency and workload versus time in one embodiment in accordance with the present invention.

FIG. 5 is a flowchart of a computer-implemented power management method in one embodiment in accordance with the present invention.

DETAILED DESCRIPTION

Reference will now be made in detail to embodiments in accordance with the present invention, examples of which are illustrated in the accompanying drawings. While the invention will be described in conjunction with these embodiments, it will be understood that they are not intended to limit the invention to these embodiments. On the contrary, the invention is intended to cover alternatives, modifications and equivalents, which may be included within the spirit and scope of the invention as defined by the appended claims. Furthermore, in the following detailed description of embodiments of the present invention, numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be recognized by one of ordinary skill in the art that the present invention may be practiced without these specific details. In other instances, well-known methods, procedures, components, and circuits have not been described in detail as not to unnecessarily obscure aspects of the embodiments in accordance with the present invention.

Some portions of the detailed descriptions, which follow, are presented in terms of procedures, steps, logic blocks, processing, and other symbolic representations of operations on data bits within a computer memory. These descriptions and representations are the means used by those skilled in the data processing arts to most effectively convey the substance of their work to others skilled in the art. A procedure, computer executed step, logic block, process, etc., is here, and generally, conceived to be a self-consistent sequence of steps or instructions leading to a desired result. The steps are those requiring physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared, and otherwise manipulated in a computer system. It has proven convenient at times, principally for reasons of common usage, to refer to these signals as bits, values, elements, symbols, characters, terms, numbers, or the like.

It should be borne in mind, however, that all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless specifically stated otherwise as apparent from the following discussions, it is appreciated that throughout the present invention, discussions utilizing terms such as “performing,” “adjusting,” “selting,” “specifying,” “selecting,” “entering,” “interrupting,” “awakening,” “monitoring,” “sending,” “predicting,” “increasing,” “decreasing,” “power gating,” “operating,” “returning,” “monitoring,” “comparing,” “measuring” or the like, refer to the actions and processes of a computer system, or similar electronic computing device, that manipulates and transforms data represented as physical (electronic) quantities within the computer system's registers and memories into other data similarly represented as physical quantities within the computer system memories or registers or other such information storage, transmission or display devices.

Embodiments described herein may be discussed in the general context of computer-executable instructions residing on some form of computer-usable medium, such as program modules, executed by one or more computers or other devices. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform particular tasks or implement particular abstract data types. The functionality of the program modules may be combined or distributed as desired in various embodiments.

By way of example, and not limitation, computer-usable media may comprise computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, random access memory (RAM), read only memory (ROM), electrically erasable programmable ROM (EEPROM), flash memory or other memory technology, compact disk ROM (CD-ROM), digital versatile disks (DVDs) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information.

Communication media can embody computer-readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency (RF), infrared and other wireless media. Combinations of any of the above should also be included within the scope of computer-readable media.

FIG. 1 is a block diagram showing an example of a computing system platform 100 upon which embodiments according to the present invention may be implemented. Embodiments in accordance with the present invention may be implemented on platforms that include functionality, components and devices other than those included in the system 100.

In the FIG. 1 embodiment, the system 100, which may be a battery-operated and/or portable device, includes a central processing unit (CPU) or microprocessor 102, a memory controller 104, a main memory 106, and audio/video processor (AVP) 108 (e.g., a multimedia player or decoder), a graphics (3D) processor 110, and an encoder 112. These elements are interconnected using one or more buses, exemplified by bus 114, such as an AMBA (Advanced Microprocessor Bus Architecture) High Speed Bus (AHB) and an AMBA Peripheral Bus (APB). Each of these elements, including the buses, may be driven using a different clock, although it is possible for different devices to be driven by the same clock. That is, a clock domain may include one or more devices.

In one embodiment, the system 100 is implemented as a system-on-a-chip (SOC). In such an embodiment, all of the blocks in the system 100, including memory, are inside the SOC.

Generally speaking, embodiments in accordance with the present invention can be implemented with multi-processor systems and/or multi-device SOCs.

In the present embodiment, the CPU 102 implements a power management technique that may be referred to as dynamic frequency scaling (DFS). In general, DFS provides a mechanism for adjusting the frequencies of the clock signals used by the devices in the system 100. Supply voltage may also be adjusted when frequency is adjusted—for example, if clock frequency is decreased, then supply voltage may be decreased as well. In general, lowering clock frequency and voltage saves power but can reduce performance. DFS may also be implemented for the CPU 102—the clock frequency used by the CPU 102 may be adjusted up or down to conserve power, depending on the workload of the CPU.

DFS may be implemented using a centralized module that is constantly running. DFS is fundamentally run from the CPU 102 and by itself is consuming power. As will be described, DFS can be disabled under certain conditions. The CPU 102 may be running only for DFS. If so, and if DFS is disabled, then the CPU 102 can be placed in a “reduced power mode”—it may be powered down or turned off. In one embodiment, the CPU is “power gated.” Power gating is a term of art and refers to a technique in which a device (e.g., the CPU 102) is temporarily turned off and then reactivated when it is needed. According to embodiments of the present invention, even if the CPU 102 is powered down or turned off, the activity of each of the devices in the system 100 is monitored. If device activity increases to a certain level, then the CPU 102 is awakened and the device is subject to DFS. These features are described in further detail in conjunction with the figures to follow.

FIG. 2A is a block diagram showing elements of a power management system 200 in one embodiment in accordance with the present invention. The system 200 includes a device 214, which may be one of the devices mentioned in connection with FIG. 1. The device 214 executes one or more software applications that in turn execute one or more tasks.

The device 214 uses a clock signal generated by a clock-generator 218. The frequency of the clock signal generated by the clock generator 218 is dynamic—it can be changed (increased or decreased) over time. In the example of FIG. 2A, the frequency of the clock signal is controlled by a dynamic frequency counter or controller (DFC) 216.

FIG. 2A shows only a single device 214. However, as shown in FIG. 2B, there may be multiple devices (device 1 214, . . . , device N 254), such as the devices mentioned above in conjunction with FIG. 1, and each of those devices may be inside an SOC as shown in FIG. 1. Each device 1, . . . , N can have its own processor and its own idle monitor 1 212, . . . , N 252, respectively, which may be a hardware element or may be running in software, either on the device itself or on the CPU 102. Also, each device 1, . . . , N can generate its own “starvation” and “busyness” triggers, which are described below.

Furthermore, in one embodiment, each device can receive a different clock signal from the clock generator 218—in general, each device 1, . . . , N can have its own clock, and a different clock frequency can be specified for each device. Different tasks can be executed on different devices, with some tasks limited to a subset of all of the devices. Also, a single task may be executed by two different devices.

Thus, the activity (e.g., amount of idle time) for each device 1, . . . , N can be individually monitored using the idle monitors 1, . . . , N, respectively. As will be seen from the discussion below, the clock frequency used by each device 1, . . . , N can be individually adjusted for DFS. Furthermore, as will be seen from the discussion below, DFS can be conditionally disabled.

For reasons of clarity, the following discussion refers to a single device 214. However, the discussion can be readily extended to multiple devices, perhaps operating in parallel, and perhaps operating on the same task or on different tasks.

With reference to FIG. 2A, an initial (baseline) frequency is specified by the CPU 102, depending on the type of task or use case to be executed by the device 214 at any time. The baseline frequency is a function of task and which device is used for the task. If multiple devices are performing the same task, a different baseline frequency may be specified for each device.

Significantly, after setting the baseline frequency initially, the CPU 102 can enter a reduced power mode until it is interrupted or otherwise needed (e.g., to adjust the frequency of the clock signal, as will be described). In the reduced power mode, the CPU 102 can be powered down or turned off. In one embodiment, the CPU 102 is power gated. In essence, the CPU 102 can be switched off while other devices continue to be powered. For example, the CPU 102 may have its own power domain and hence may be powered by an external power supply.

Thus, once the CPU 102 specifies an initial (or baseline) clock frequency for the device 214 based on the identified task, it enters an inactive (e.g. “asleep”) mode. The device 214 executes the task using the baseline frequency after the CPU 102 enters the reduced power mode.

If the baseline frequency needs to be increased because the performance level associated with the baseline frequency is not adequate to perform the task in a manner required or desired, the CPU 102 can be awakened using an interrupt that is issued by the device 214 in response to a triggering event. Triggering events are generally categorized herein as “starvation” triggers and “busyness” triggers. Triggering events may also be referred to as real-time events.

An example of a starvation trigger is buffer fullness. In general, a certain amount of buffer capacity (e.g., a certain number of buffers) is associated with the device 214. It is generally desirable to fill the buffers to a certain level but not completely, so that the buffers do not overflow yet the device 214 will not be starved for data when data is needed. This is particularly true for tasks that involve decoding or processing audio and/or video data for real-time rendering. In one embodiment, the device 214 sends an interrupt to the CPU 102 if a measure of buffer capacity fails to satisfy a predefined threshold. For example, if remaining buffer capacity falls below the predefined threshold, then an interrupt is generated. In response to the interrupt, the CPU 102 awakens so that it can specify a new (higher) frequency for the clock generator 218, thereby increasing the performance of the device 214. Different devices may have different thresholds—each device can have its own threshold for detecting real time starvation. Also, the buffer capacity threshold may depend on the type of task—for a given device, different thresholds may be set for different tasks.

An example of a busyness trigger is a predicted change in workload for the device 214. For example, the device 214 may be executing a particular task when the device driver identifies a pending task that is more computationally intensive then the currently executing task. In one embodiment, the device 214 sends an interrupt to the CPU 102 if the device predicts an increase in its workload. In response to the interrupt, the CPU 102 awakens so that it can specify a new (higher) frequency for the clock generator 218.

Once awakened, the CPU 102 stays awake so that it can continue to dynamically adjust the frequency of the clock signal according to the time-dependent workload of the device 214. Based on the measured idleness of the device, the frequency may be increased or decreased. Supply voltage may also be adjusted when frequency is adjusted—for example, if clock frequency is decreased, then supply voltage may be decreased as well. If the clock frequency is subsequently reset to the baseline frequency, then the CPU 102 can re-enter the reduced power mode.

The embodiment of FIG. 2A includes an idle monitor 212, which may be implemented in hardware and/or software. In general, the idle monitor 212 measures the amount of time that the device 214 is idle. A similar idle monitor may be associated with each device and bus in the system 100. In one embodiment, the idle monitor 212 counts the number of clock cycles that the device 214 is idle during each sample interval. In one embodiment, an average count is determined for a moving window of time. That is, the number of idle clock cycles is counted over a first sample interval, a second sample interval, and so on, up to N consecutive sample intervals. The counts for the set of 1 to N sample intervals are then averaged to determine the amount of idle time for a first window of time. The count for the first sample interval is removed from the set and replaced with the count for the (N+1)^(th) sample interval, and the counts for the set of 2 to (N+1) sample intervals are averaged to determine the amount of idle time for a second window of time, and so on.

In one embodiment, the length of the sample intervals depends on clock frequency—if clock frequency is reduced, the length of the sample intervals is increased. Extending the length of the sample intervals reduces power consumption.

For a given workload, the amount of idle time is a function of clock frequency—increasing the clock frequency increases idle time, and decreasing the clock frequency decreases idle time. Zero idle time is ideal, but in actual practice maintaining zero idle time may not be desirable because there may not be enough time to respond to sudden changes in workload. Consequently, an acceptable amount of idle time is defined and used as a threshold value against which the measured amount of idle time can be compared. If the measured amount of idle time is less than the threshold value, then the clock frequency can be increased. Too little idle time may be referred to as non-real time starvation. If the measured amount of idle time is above the threshold value, then the clock frequency can be decreased. Power consumption is a function of clock frequency, and so power can be conserved by decreasing the clock frequency when it is acceptable to do so. Different threshold values may be specified for different devices—each device can have its own threshold for detecting non-real time starvation. Also, the idleness threshold may depend on the type of task—for a given device, different thresholds may be set for different tasks.

Thus, in general, the value of a selected metric (e.g., idle time) is monitored, and if that metric fails to satisfy a condition (e.g., it is too high or too low in comparison to a threshold value) then the frequency of the clock signal generated by the clock generator 218 is adjusted (decreased or increased, respectively) by the CPU 102. Supply voltage may also be adjusted when frequency is adjusted.

Two threshold values may be used instead of a single threshold: one threshold can be used to determine whether idle time is too high; the other threshold can be used to determine whether idle time is too low; and if the amount of idle time falls between the two thresholds, then the clock frequency is maintained at its current value.

FIG. 3 is a representation of a clock signal frequency adjustment loop 300 in one embodiment in accordance with the present invention. The loop 300 is implemented using the system 200 of FIG. 2A. A feedback loop such as the loop 300 can be implemented in parallel for each device in the system 100 of FIG. 1. That is, there are multiple loops such as the loop 300 running on the CPU 102 for the multiple devices, including a loop for the CPU 102 itself. According to embodiments of the present invention, the loop 300 is used to control and adjust clock frequency only if the CPU 102 is awake; otherwise, the device performing the task uses the baseline frequency. When the CPU 102 is not awake, an interrupt (in response to a triggering event) sent from that device activates the loop 300.

With reference to FIG. 3, the DFC 216, responsive to the CPU 102, controls the frequency of the clock signal generated by the clock generator 218. A device (e.g., the device 214 of FIG. 2A) in the clock domain of the clock generator 218 uses the clock signal to perform a task that is part of an application. The idle monitor 212 measures the degree of idleness of the device, which is compared to the appropriate threshold in the manner described above, resulting in adjustment of the clock frequency, if necessary, to maintain the threshold amount of idleness. Furthermore, the clock frequency can be adjusted in response to a triggering event identified by the device's driver, the application or the task, as described above. Supply voltage may also be adjusted when frequency is adjusted.

For clarity, the discussion of FIGS. 4 and 5 below may imply the use of a single loop 300. However, as noted above, there can be multiple such loops implemented in parallel for each device in the system 100.

FIG. 4 is a diagram showing clock signal frequency and device workload versus time in one embodiment in accordance with the present invention. Prior to time T0, the CPU 102 identifies a task to be performed, identifies which device or devices are needed to perform the task, and sets a baseline frequency for each device (or for each clock domain that includes the identified device(s)). Devices not needed to perform the task may be power gated.

In the example of FIG. 4, a baseline frequency of 10 MHz is specified for the task at hand for one of the devices (e.g., the device 214 of FIG. 2A). Different baseline frequencies can be specified per task (or per use case) and per device (or per clock domain). The baseline frequencies per task or use case, and per device or clock domain, can be implemented using lookup tables, for example.

In region A, from time T0 to time T1, the CPU 102 is placed in a reduced power mode. That is, depending on the implementation, the CPU 102 may be powered down to a reduced power level or turned off completely (e.g., power gated).

In FIG. 4, one of the lines is labeled “device workload.” The workload line is not an actual measure of workload. In a sense, the workload line in FIG. 4 can be interpreted as the clock frequency that, if used, would result in the threshold amount of idle time (as described above, although zero idle time is ideal, in actual practice some idle time is permitted and a threshold value is defined accordingly). In general, the workload changes over time; in regions A and C, the baseline frequency is high enough to accommodate the workload in those regions; and in region B, the baseline frequency is adjusted to generally track the workload.

The workload on the device 214 need not be measured directly, although it may be. It is not necessarily important to precisely quantify the workload; instead, it is important to be able to identify when the workload has increased to the point where the baseline frequency has to be increased. This is accomplished using a starvation or busyness trigger as described above.

In region A, although the task at hand could in theory be accomplished at less than the baseline frequency, the clock frequency used by the device 214 is not reduced to less than the baseline frequency. Therefore, in region A, the device 214 may be operating using a higher clock frequency than needed, and thus may be consuming more power than required. However, as noted above, in region A the CPU 102 is in a reduced power state and may even be turned off. By intelligently selecting the baseline frequency, any power “lost” by driving the device 214 at a clock frequency higher than what may be needed is offset by the power savings that result from powering down or turning off the CPU 102. Thus, in region A (as well as in region C), net power consumption is reduced.

In the example of FIG. 4, a triggering event occurs at time T1. For example, a measure of remaining buffer capacity might fail to satisfy a corresponding threshold, or an increase in workload may be predicted. As a result of the triggering event, an interrupt is generated in order to wake up the CPU 102. In response to the interrupt, the CPU 102 increases the baseline clock frequency by a predetermined amount in order to accommodate the anticipated increase in workload. In the example of FIG. 4, at time T1, the clock frequency is increased to 11 MHz. The point at which the CPU 102 is awakened and the clock frequency is increased may be referred to as a “corner,” and more specifically as a “high corner.”

In region B, the CPU 102 is awake. Idle time of the device 214 is monitored and the clock frequency is adjusted accordingly as described in conjunction with FIGS. 2 and 3 above. In one embodiment, to determine idle time, a count is made of the number of clock cycles that the device 214 is idle over one or more sample intervals. The amount of idle time may be an average value of measurements taken over a moving window of some number of consecutive intervals. Periodically, e.g., each time an average measured value is determined, the measured amount of idle time is compared to a threshold or thresholds. If a single threshold is used and the measured amount of idle time is too high, then the clock frequency is decreased; otherwise, the clock frequency is further increased by, for example, a predetermined amount (e.g., another 1 MHz increment). If two thresholds are used, then the clock frequency can be decreased if the measured amount of idle time is too high; increased if the measured amount of idle time is too low; or kept at its current value if the measured amount of idle time is between the two thresholds.

In the example of FIG. 4, at time T2, the clock frequency is reset to the baseline value. That is, at time T2, the device's workload has decreased, and the amount of idle time has commensurately increased, to the point where the clock frequency can again be set to the baseline value. Upon setting the clock frequency to the baseline value, the CPU 102 can again be placed in the reduced power mode. The point at which the clock frequency is reset to the baseline value and the CPU 102 returned to the reduced power mode may be referred to as a “low corner.”

In summary, in regions A and C, the CPU 102 is in a reduced power mode, a metric such as idle time is not measured, and clock frequency is not adjusted. In region B, the CPU 102 is active, idle time is measured, and clock frequency is adjusted. Supply voltage may also be adjusted when frequency is adjusted. In regions A and C, triggering events are used to awaken the CPU 102—in a sense, the triggering events provide early warning of the need to initially increase and subsequently adjust clock frequency based on workload.

In other words, DFS is disabled in regions A and C but enabled in region B. When DFS is disabled, triggering events are relied upon to identify that DFS needs to be enabled. In regions A and C, when the workload is accomplished by the device 214, the CPU 102 has very little or no work to do. In some instances, the only reason the CPU 102 would be active is to perform DFS. Whether implemented in hardware or software, the idle monitor 212 (FIG. 2A), and any other elements associated with the implementation of DFS, will consume power when DFS is enabled. Disabling DFS and powering down or turning off the CPU 102 means that the idle monitor 212 can also be shut down.

FIG. 5 is a flowchart 500 of computer-implemented power management methods in accordance with embodiments of the present invention. Although specific steps are disclosed in the flowchart 500, such steps are exemplary. That is, embodiments of the present invention are well-suited to performing various other steps or variations of the steps recited in the flowchart 500.

Blocks 510, 520 and 530 are performed with the CPU 102 (FIG. 1) in its normal or active power mode. In block 510, the type of task (or use case) to be performed is identified. In block 520, the device or device(s)—or their respective clock domain(s)—that will perform the task are identified. In block 530, a baseline frequency specific to both the task and the device is selected, and the device is instructed to begin the task. The CPU 102 can also specify a buffer capacity threshold and/or an idleness threshold for the device. The buffer capacity threshold and the idleness threshold may also be specific to the type of task.

In block 540, the CPU 102 enters a reduced power mode (e.g., it is powered down or turned off). In one embodiment, the CPU 102 is power gated.

In block 550, while the device is performing the task using the baseline clock frequency, an interrupt is generated as a result of a triggering event (e.g., a starvation event or a busyness event), described above.

In block 560, the CPU 102 is awakened in response to the interrupt of block 550. That is, the CPU 102 exits the reduced power mode and returns to its normal power mode.

In block 570, the CPU 102 implements DFS. In other words, the CPU 102 adjusts (scales) clock frequency according to the current workload of the device. Supply voltage may also be adjusted when frequency is adjusted. In one embodiment, the amount of idle time is used as a measure of workload. If the amount of time that the device is idle is greater than a corresponding threshold, then the CPU 102 decreases the clock frequency. If the amount of time that the device is idle is less than a corresponding threshold, then the CPU 102 increases the clock frequency. The clock frequency used by the device may also be kept at its current value.

In block 580, if the clock frequency is reset to the baseline frequency, then the CPU 102 re-enters the reduced power mode. That is, if the workload is reduced to a low enough level, then DFS can be disabled and the CPU 102 can be powered down or turned off (e.g., power gated). Blocks 540 through 580 can be repeated until the task is completed.

In summary, embodiments according to the present invention provide methods and systems for conserving power. Such systems and methods are particularly useful in limited-power devices such as battery-powered devices. Power is conserved on at least two fronts. First, power consumption is reduced because the CPU is not running continuously at full power—once the CPU selects a device and a baseline frequency, it can be powered down or turned off until it is needed. Second, the frequency of the clock signal used by the device is adjusted up and down depending on workload—because power usage is a function of clock frequency, the capability to scale frequency to workload means that power is used more efficiently. Supply voltage may also be adjusted when frequency is adjusted. By intelligently selecting an appropriate baseline frequency and then adjusting it as needed, and by selectively running the CPU to implement DFS, a net savings in power is realized. As a result, limited-power devices can be used for longer periods of time and, for a given workload, batteries can be recharged less frequently.

The foregoing descriptions of specific embodiments of the present invention have been presented for purposes of illustration and description. They are not intended to be exhaustive or to limit the invention to the precise forms disclosed, and many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the invention and its practical application, to thereby enable others skilled in the art to best utilize the invention and various embodiments with various modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the claims appended hereto and their equivalents. 

1. A system for adjusting clock frequency, said system comprising: a device operable for executing a task; and a processor coupled to said device, wherein said processor specifies a value for a frequency for a clock signal used by said device and thereafter said processor is placed in a reduced power mode; wherein said device is operable to perform said task after said processor is placed in said reduced power mode until a triggering event causes said device to send an interrupt to said processor; wherein in response to said interrupt said processor awakens to dynamically adjust said frequency of said clock signal so that a metric satisfies a first condition, and wherein if said frequency of said clock signal returns to said value then said processor is again placed in said reduced power mode.
 2. The system of claim 1 wherein said interrupt is sent based on a measure of buffer capacity of a buffer associated with said device.
 3. The system of claim 1 wherein said interrupt is sent if a measure of workload is predicted to change during execution of said task.
 4. The system of claim 1 wherein said metric is based on an amount of time said device is idle while said task is executed.
 5. The system of claim 4 wherein said processor increases said value of said frequency of said clock signal if said metric is less than a corresponding threshold value and decreases said value for said frequency for said clock signal if said metric is more than a corresponding threshold value.
 6. The system of claim 4 wherein said amount of time is measured over a sample interval, wherein said sample interval is extended in length if said value for said frequency of said clock signal is reduced.
 7. The system of claim 1 wherein said value for said frequency of said clock signal is specified according to a type of said task.
 8. The system of claim 1 wherein reduced power mode comprises power gating said processor.
 9. A method of managing power consumption in an electronic system, said method comprising: with a processor operating in a first power mode, selecting a device to perform a task and selecting a value for a frequency for a clock used by said device; entering a reduced power mode at said processor after said device and said value are selected, wherein said frequency of said clock remains set to said value until a triggering event causes said device to send an interrupt to said processor; awakening said processor in response to said interrupt so that said processor can dynamically adjust said value; and re-entering said reduced power mode at said processor if said frequency of said clock is adjusted to said value.
 10. The method of claim 9 further comprising: monitoring a measure of buffer capacity associated with said device; and sending said interrupt if said measure is less than a threshold.
 11. The method of claim 9 further comprising sending said interrupt if an increase in workload associated with performing said task is predicted.
 12. The method of claim 9 further comprising: with said processor in said first operating mode subsequent to said awakening, monitoring a metric that corresponds to an amount of time said device is idle while performing said task; increasing said value of said frequency for said clock if said metric is less than a corresponding threshold value; and decreasing said value of said frequency for said clock if said metric is greater than a corresponding threshold value.
 13. The method of claim 9 wherein said selecting further comprises selecting said value for said frequency for said clock depending on a type of said task.
 14. The method of claim 9 further comprising power gating said processor in said reduced power mode.
 15. A method of managing power consumption in an electronic system, said method comprising: with a processor in a reduced power mode, operating a device to perform a task using a clock signal having a frequency set to a first frequency value; sending an interrupt to said processor in response to a triggering event, wherein said triggering event indicates a requirement to increase said frequency of said clock signal, wherein said interrupt causes said processor to exit said reduced power mode; subsequent to said interrupt, increasing said frequency of said clock signal to a second frequency value specified by said processor; subsequent to increasing said frequency of said clock signal, monitoring a metric associated with said device; and comparing said metric to a threshold and adjusting said frequency of said clock signal based on a result of said comparing.
 16. The method of claim 15 further comprising: operating said processor in a first power mode to specify said first frequency value; operating said processor in said reduced power mode after said first frequency value is specified and until said interrupt; and returning said processor to said reduced power mode if said frequency of said clock signal is adjusted to said first frequency value.
 17. The method of claim 15 further comprising: monitoring a measure of buffer capacity associated with said device; and sending said interrupt if said measure is less than a threshold.
 18. The method of claim 15 further comprising sending said interrupt in response to predicting an increase in workload associated with performing said task.
 19. The method of claim 15 wherein said metric corresponds to an amount of time said device is idle while performing said task.
 20. The method of claim 15 wherein said adjusting comprises: increasing said frequency of said clock signal if said metric is less than a corresponding threshold value; and decreasing said frequency of said clock signal if said metric is greater than a corresponding threshold value. 